package main

import (
	"errors"
	"fmt"
)

func division(n1, n2 int) (int, error) {
	if n2 == 0 {
		// return 0, errors.New("division is zero!")
		return 0, fmt.Errorf("division is zero!")
	}
	return n1 / n2, nil
}

func main() {
	for _, v := range [...]int{0, 3} {
		r, err := division(6, v)
		if err != nil {
			fmt.Println(err)
		} else {
			fmt.Println(r)
		}
	}

	err1, err2 := errors.New("error: 1"), fmt.Errorf("error: %d", 2)
	fmt.Printf("%T,%T,%v,%v", err1, err2, err1, err2)
}
